#encoding:gbk
import time
import datetime

import wave

import pyaudio
p = pyaudio.PyAudio()
filepath = "D:/aduio/1001.wav"
def audio(filepath):
    t1=time.time()
    f = wave.open(filepath,'rb')
    pms = f.getparams()
    nchannels, sampwidth, framerate, nframes = pms[:4]
    s = p.open(format = p.get_format_from_width(sampwidth), channels = nchannels,rate = framerate,output = True)
    while True:
        data = f.readframes(1024)
        s.write(data)
        if len(data)==0:
            break
    t2=time.time()

    print "over","time is :",t2-t1
#print max(1,2)
a=125.1123
print type(a)
print round(float(a),2)
while True:
    audio(filepath)